<?php
declare(strict_types=1);

namespace App\Common\Modular\Data\Serve;

use App\Common\Modular\Data\Model\ResourceModel;
use Core\Basics\BasicsServe;
use Zms\Unit\Is;
use Hyperf\Database\Model\Builder;

class ResourceServe extends BasicsServe
{
    /**
     * @return ResourceModel::class
     */
    public static function model(): string
    {
        return ResourceModel::class;
    }

    /**
     * 资源名称搜索
     * @param Builder $query
     * @param $value
     * @author 竹林风@875384189 2021/9/8 10:22
     */
    public function searchName(Builder $query, $value): void
    {
        if (Is::notEmpty($value)) {
            $query->where('name', 'LIKE', "%$value%");
        }
    }
}